<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/maa.tld" prefix="m" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>Account</title>
    <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/css/style.css"/>
</head>
<body>
Account
<c:if test="${not empty user}">
    <table border="1">
        <tr>
            <th>Name</th>
            <th>Surname</th>
            <th>Email</th>
            <th>Password</th>
            <th>Birthdate</th>
            <th>Gender</th>
            <th>Role</th>
        </tr>
        <tr>
            <td>${user.name}</td>
            <td>${user.surname}</td>
            <td>${user.email}</td>
            <td>${user.password}</td>
            <td>${user.birthdate}</td>
            <td>${user.gender}</td>
            <td>${user.role}</td>
        </tr>
    </table>
</c:if>
<c:if test="${not empty courses}">
    <table border="1">
        <tr>
            <th>Name</th>
            <th>Description</th>
            <th>Price</th>
            <th>Mentor</th>
            <th></th>
        </tr>
        <c:forEach items="${courses}" var="course">
            <tr>
                <td>${course.courseName}</td>
                <td>${course.courseDescription}</td>
                <td>${course.courseMonthlyPrice}</td>
                <td>${course.mentor.name}</td>
                <td><form action="/maa/do" method="post"><input type="hidden" name="action" value="unsubscribe"/>
                    <input type="hidden" name="course-uuid" value=${course.uuid}/>
                    <input class="btn" type="submit" value="Unsubscribe"/></form></td>
            </tr>
        </c:forEach>
    </table>
</c:if>
<form action="/maa/do" method="post"><input type="hidden" name="action" value="user-update-page"/>
    <input type="hidden" name="uuid" value=${user.uuid}/>
    <input class="btn" type="submit" value="Update"/></form>
<form action="/maa/do" method="get"><input type="hidden" name="action" value="my-subscriptions"/>
    <input type="hidden" name="uuid" value=${user.uuid}/>
    <input class="btn" type="submit" value="My subscriptions"/></form>
<form action="/maa/do" method="get"><br>
    <input type="hidden" name="action" value="main"/>
    <input class="btn" type="submit" value="Return"/>
</form>
</body>
</html>